home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / set_xy.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  83 lines

  1. ; $Id: set_xy.pro,v 1.3 1997/01/15 04:02:19 ali Exp $
  2. ;
  3. ; Copyright (c) 1989-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro set_xy, xmin, xmax, ymin, ymax
  7. ;+
  8. ; NAME:
  9. ;    SET_XY
  10. ;
  11. ; PURPOSE:
  12. ;    This procedure emulates the Version I, VMS/IDL SET_XY procedure
  13. ;    to set the default axis ranges. 
  14. ;
  15. ; CATEGORY:
  16. ;    Plotting.
  17. ;
  18. ; CALLING SEQUENCE:
  19. ;    SET_XY, Xmin, Xmax [, Ymin, Ymax]
  20. ;
  21. ; INPUTS:
  22. ;    Xmin:    Minimum X data coordinate of the plotting data window.
  23. ;    Xmax:    Maximum X data coordinate of the plotting data window.
  24. ;
  25. ; OPTIONAL INPUT PARAMETERS:
  26. ;    Ymin:    Minimum Y data coordinate of the plotting data window.
  27. ;    Ymax:    Maximum X data coordinate of the plotting data window.
  28. ;
  29. ; KEYWORD PARAMETERS:
  30. ;    None.
  31. ;
  32. ; OUTPUTS:
  33. ;    No explicit outputs.
  34. ;
  35. ; SIDE EFFECTS:
  36. ;    Sets the RANGE, CRANGE, and S fields of !X and !Y.
  37. ;
  38. ; RESTRICTIONS:
  39. ;    SET_XY should only be used to emulate VMS Version I of IDL.
  40. ;    This procedure does a number of things which generally should
  41. ;    not be done.
  42. ;
  43. ; PROCEDURE:
  44. ;    Straightforward.
  45. ;
  46. ; MODIFICATION HISTORY:
  47. ;    DMS, June, 1989.
  48. ;-
  49. on_error,2              ;Return to caller if an error occurs
  50. n = n_params()
  51. if n eq 0 then begin    ;Reset if no params?
  52.     !x.range = 0
  53.     !y.range = 0
  54.     endif
  55. if n ge 2 then begin    ;set X ?
  56.     !x.range = [ xmin, xmax]
  57.     !x.crange = !x.range
  58.     if !x.window(0) eq !x.window(1) then begin ;Window already set?
  59.         tmp = !x.margin*!d.x_ch_size / !d.x_size
  60.         !x.window = [ tmp(0), 1.0 - tmp(1)]
  61.         endif ;window set
  62.         ;Compute slope and intercept
  63.     if (xmax ne xmin) then $
  64.       !x.s(1) = (!x.window(1) - !x.window(0)) / (xmax - xmin) $
  65.     else !x.s(1) = 1.
  66.     !x.s(0) = !x.window(0) - !x.s(1) * xmin
  67.     endif        ;X present
  68.     
  69. if n ge 4 then begin    ;Do Y
  70.     !y.range = [ ymin, ymax]
  71.     !y.crange = !y.range
  72.     if !y.window(0) eq !y.window(1) then begin ;Window already set?
  73.         tmp = !y.margin*!d.y_ch_size / !d.y_size
  74.         !y.window = [ tmp(0), 1.0 - tmp(1)]
  75.         endif ;window set
  76.         ;Compute slope and intercept
  77.     if ymax ne ymin then $
  78.       !y.s(1) = (!y.window(1) - !y.window(0)) / (ymax - ymin) $
  79.     else !y.s(1) = 1.0
  80.     !y.s(0) = !y.window(0) - !y.s(1) * ymin
  81.     endif            ;Y present
  82. end
  83.